package com.usian.admin.controller;

import com.usian.admin.service.AdChannelService;
import com.usian.apis.admin.AdChannelControllerApi;
import com.usian.model.admin.dtos.ChannelDto;
import com.usian.model.admin.pojos.AdChannel;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
public class AdChannelController implements AdChannelControllerApi {
    @Autowired
    private AdChannelService adChannelService;

    @PostMapping("list")
    @Override
    public ResponseResult findByNameAndPage(@RequestBody ChannelDto dto) {
        return adChannelService.findByNameAndPage(dto);
    }

    @PostMapping("add")
    @Override
    public ResponseResult AddAdChannel(@RequestBody AdChannel adChannel) {
        return adChannelService.AddAdChannel(adChannel);
    }

    @PostMapping("update")
    @Override
    public ResponseResult UpdateAdChannel(@RequestBody AdChannel adChannel) {
        return adChannelService.UpdateAdChannel(adChannel);
    }

    @GetMapping("delete/{id}")
    @Override
    public ResponseResult DeleteAdChannel(@PathVariable Integer id) {
        return adChannelService.DeleteAdChannel(id);
    }
}
